package lava.rt.persistence.nosql;

import java.io.Closeable;
import java.io.IOException;
import java.util.Collection;

import org.bson.Document;

import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;

import lava.rt.expcption.PersistenceExecption;
import lava.rt.persistence.DataContext;
import lava.rt.persistence.Entity;

public class MongoDataContext implements DataContext, Closeable {

	private final ThreadLocal<MongoDatabase> readConnection = new ThreadLocal<>(),
			writeConnection = new ThreadLocal<>();

	

	

	@Override
	public <E extends Entity> E getEntity(Class<E> cls, Object pk) throws PersistenceExecption {
		MongoCollection<Document> collection=readConnection.get().getCollection(null);
		
		return null;
	}

	@Override
	public <E extends Entity> int addEntities(Collection<E> entities) throws PersistenceExecption {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int addEntity(Entity entity) throws PersistenceExecption {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int setEntity(Entity entity) throws PersistenceExecption {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public <E extends Entity> int setEntities(Collection<E> entities) throws PersistenceExecption {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int removeEntity(Entity entity) throws PersistenceExecption {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public <E extends Entity> int removeEntities(Collection<E> entities) throws PersistenceExecption {
		// TODO Auto-generated method stub
		return 0;
	}

	
	@Override
	public void close() throws IOException {
		// TODO Auto-generated method stub
		
	}
}
